import { createBrowserRouter } from "react-router-dom";
import MainLayout from "../mainLayout";
import Login from "../views/login";
import Detail from "../views/detail";
import Search from "../views/search";
import Home from "../views/home";
import Classify from "../views/classify";
import XiaoMi from "../views/xiaoMi";
import Cart from "../views/cart";
import User from "../views/user";
import { HomeO, CartCircle, LabelO, FriendsO, UserO } from "@react-vant/icons";
// 二级
export const tabbar_children = [
  {
    path: "/",
    meta: {
      // tabbar 标题配置
      title: "首页",
      // tabbar 图标配置
      icon: <HomeO />,
    },
    element: <Home></Home>,
  },
  {
    path: "/classify",
    meta: {
      title: "分类",
      icon: <LabelO />,
    },
    element: <Classify></Classify>,
  },
  {
    path: "/xiaomi",
    meta: {
      title: "米圈",
      icon: <FriendsO />,
    },
    element: <XiaoMi></XiaoMi>,
  },
  {
    path: "/cart",
    meta: {
      title: "购物车",
      icon: <CartCircle />,
    },
    element: <Cart></Cart>,
  },
  {
    path: "/user",
    meta: {
      title: "用户",
      icon: <UserO />,
    },
    element: <User></User>,
  },
];

// 一级
export const router = createBrowserRouter([
  {
    path: "/",
    meta: {
      title: "布局也",
    },
    element: <MainLayout></MainLayout>,
    // 二级路由 ｜ 子路由
    children: tabbar_children,
  },
  {
    path: "/login",
    meta: {
      title: "登陆",
    },
    element: <Login></Login>,
  },
  {
    path: "/detail",
    meta: {
      title: "详情",
    },
    element: <Detail></Detail>,
  },
  {
    path: "/search",
    meta: {
      title: "搜索",
    },
    element: <Search></Search>,
  },
]);
